package com.credit.service;

import java.util.Date;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.credit.entity.CreditPaymentOrder;
import com.credit.repository.CreditPaymentOrderDao;

@Service("creditPaymentOrderService")
@Transactional
public class CreditPaymentOrderService {
	@Autowired
	private CreditPaymentOrderDao creditPaymentOrderDao;

	public void addPaymentOrder(CreditPaymentOrder paymentOrder) {
		
		creditPaymentOrderDao.save(paymentOrder);
		
	}

	public CreditPaymentOrder findPaymentOrderById(String out_trade_no) {
		
		return creditPaymentOrderDao.findOne(out_trade_no);
	}



	public void updatePaymentOrder(CreditPaymentOrder paymentOrder) {
		paymentOrder.setCallbackTime(new Date());
		paymentOrder.setUpdateTime(new Date());
		creditPaymentOrderDao.save(paymentOrder);
		
	}

}
